import baseUrl from '@/utils/base.js'

// 封装网络请求
function ajax(options) {
	const {
		method = "GET", url, data = {}, header = {
			"content-type": "application/json",

		}
	} = options
	// console.log(data);
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseUrl + url,
			method,
			data,
			header,
			success(res) {
				// console.log(res);
				resolve(res.data)
			},
			fail(err) {
				reject(err)
			}
		})
	})
}

export default ajax